package com.wdd.owntool.ui.mvp.presenter



import com.wdd.libbase.mvp.BasePresenter
import com.wdd.libhttp.bean.ResultData
import com.wdd.libhttp.http.CommonObserver
import com.wdd.owntool.bean.TestData
import com.wdd.tools.mvp.contract.MvpContract
import javax.inject.Inject

/**
 *
 * @ProjectName:    OwnTool
 * @Package:        com.wdd.owntool.ui.mvp.presenter
 * @ClassName:      MvpPresenter
 * @Description:     java类作用描述
 * @Author:         王丹丹
 * @CreateDate:     2019/12/9 14:11
 * @UpdateUser:     更新者
 * @UpdateDate:     2019/12/9 14:11
 * @UpdateRemark:   更新说明
 * @Version:        1.0
 */
class MvpPresenter @Inject constructor(rootView: MvpContract.View, model: MvpContract.Model) :
    BasePresenter<MvpContract.View, MvpContract.Model>(rootView, model), MvpContract.Presenter {

    override fun obtainBaidu() {
        mModel!!.obtainBaidu().doOnSubscribe {
            mRootView?.showHttpLoading()
        }.`as`(bindLifecycle<String>())
            .subscribe(object : CommonObserver<ResultData<TestData>>() {
                override fun onFailData(message: String) {
                }

                override fun onComplete() {
                    mRootView?.hideHttpLoading()
                }

                override fun onSuccessData(mData: ResultData<TestData>) {
                    mRootView?.showBaidu(mData.code.toString())
                }

            })

    }

    override fun obtainUser() {
    }
}